﻿@{
    Layout = null;
}
@model IEnumerable<Model.Sub>
@{
    string studentname = System.Web.HttpUtility.UrlDecode(Request.Cookies["studentInfo"]["studentName"], System.Text.Encoding.UTF8);
    string studentnum = System.Web.HttpUtility.UrlDecode(Request.Cookies["studentInfo"]["studentNum"], System.Text.Encoding.UTF8);
    string studentPic = System.Web.HttpUtility.UrlDecode(Request.Cookies["studentInfo"]["studentPicture"], System.Text.Encoding.UTF8);
}
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>选课-考察课程</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="~/Content/UI/vendor/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="~/Content/UI/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" href="~/Content/UI/css/fontastic.css">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="~/Content/UI/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="~/Content/UI/css/custom.css">
    <!-- Favicon-->
    <link rel="shortcut icon" href="~/Content/UI/img/favicon.ico">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
        <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
        <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
  </head>
  <body>
    <div class="page">
      <!-- Main Navbar-->
      <header class="header">
        <nav class="navbar">
          <!-- Search Box-->
          <div class="search-box">
            <button class="dismiss"><i class="icon-close"></i></button>
            <form id="searchForm" action="#" role="search">
              <input type="search" placeholder="What are you looking for..." class="form-control">
            </form>
          </div>
          <div class="container-fluid">
            <div class="navbar-holder d-flex align-items-center justify-content-between">
              <!-- Navbar Header-->
              <div class="navbar-header">
                <!-- Navbar Brand --><a href="/student/index" class="navbar-brand d-none d-sm-inline-block">
                  <div class="brand-text d-none d-lg-inline-block"><span>练习生选课系统 </span><strong></strong></div>
                  <div class="brand-text d-none d-sm-inline-block d-lg-none"><strong>练习生</strong></div></a>
                <!-- Toggle Button--><a id="toggle-btn" href="#" class="menu-btn active"><span></span><span></span><span></span></a>
              </div>
              <!-- Navbar Menu -->
              <ul class="nav-menu list-unstyled d-flex flex-md-row align-items-md-center">
                <!-- Search-->
                <li class="nav-item d-flex align-items-center"><a id="search" href="#"><i class="icon-search"></i></a></li>
                <li class="nav-item"><a href="/login/index" class="nav-link logout"> <span class="d-none d-sm-inline">登出</span><i class="fa fa-sign-out"></i></a></li>
              </ul>
            </div>
          </div>
        </nav>
      </header>
      <div class="page-content d-flex align-items-stretch"> 
        <!-- Side Navbar -->
        <nav class="side-navbar">
          <!-- Sidebar Header-->
          <div class="sidebar-header d-flex align-items-center">
            <div class="avatar"><img src=@studentPic alt="..." class="img-fluid rounded-circle"></div>
            <div class="title">
              <h1 class="h4">@studentname</h1>
              <p>@studentnum</p>
            </div>
          </div>
          <!-- Sidebar Navidation Menus--><span class="heading">菜单</span>
          <ul class="list-unstyled">
                    <li ><a href="/student/index"> <i class="icon-home"></i>首页 </a></li>
                    <li class="active"><a href="#exampledropdownDropdown11" aria-expanded="false" data-toggle="collapse"> <i class="icon-grid"></i>选课 </a>
                        <ul id="exampledropdownDropdown11" class="collapse list-unstyled ">
                        <li><a href="/student/kskc">考试课程</a></li>
                        <li class="active"><a href="/student/kckc">考察课程</a></li>
                        
                      </ul>
                    </li>
                    <li><a href="#exampledropdownDropdown" aria-expanded="false" data-toggle="collapse"> <i class="icon-interface-windows"></i>个人信息 </a>
                      <ul id="exampledropdownDropdown" class="collapse list-unstyled ">
                        <li><a href="/student/sxkc">所选课程</a></li>
                        <li><a href="/student/editinfo">修改信息</a></li>
                      </ul>
                    </li>
                    <li><a href="/login/index"> <i class="icon-interface-windows"></i>退出登录 </a></li>
          </ul>
        </nav>
        <div class="content-inner">
          <!-- Page Header-->
          <header class="page-header">
            <div class="container-fluid">
              <h2 class="no-margin-bottom">考察课程</h2>
            </div>
          </header>
          <!-- Breadcrumb-->
          <div class="breadcrumb-holder container-fluid">
            <ul class="breadcrumb">
              <li class="breadcrumb-item"><a href="/student/index">首页</a></li>
              <li class="breadcrumb-item active">考察课程            </li>
            </ul>
              
          </div>
            <div style="margin-left:100px;margin-top:20px;margin-bottom:-40px">
                <button type="submit" id="select" class="btn btn-primary">确认选课</button>
            </div>
            <!--<input type="button" value="确认选课" />-->
            <section class="tables">
                    <div>
                        <table class="table" id="table">

                            <thead>
                                <tr>
                                    <th></th>
                                    <th>序号</th>
                                    <th>课程名称</th>
                                    <th>任课老师</th>
                                    <th>课程学时</th>
                                    <th>上课教室</th>
                                    <th>课程学分</th>
                                    <th>开课时间</th>
                                    <th>结课时间</th>
                                    <th>需要人数</th>
                                    <th>已选人数</th>
                                    <th>课程类型</th>
                                    <th>课程状态</th>

                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    @foreach (var row in Model)
                                    {
                                        <tr>

                                            <td>
                                                <input type="checkbox" checked="checked"></td>
                                            <td>@row.SubID</td>
                                            <td>@row.SubName</td>
                                            @{
                                        BLL.BLLTeacher blltea = new BLL.BLLTeacher();
                                        string teacherame = blltea.Details(c => c.TeacherID == row.TeacherID).FirstOrDefault().TeacherName;
                                            }
                                            <td>@teacherame</td>
                                            <td>@row.ClassTime</td>
                                            @{
                                        BLL.BLLClass bllclass = new BLL.BLLClass();
                                        string classname = bllclass.Details(c => c.ClassForm == row.ClassAddress).FirstOrDefault().ClassName;
                                            }
                                            <td>@classname</td>
                                            <td>@row.SubPoint</td>
                                            <td>@row.StartTime</td>
                                            <td>@row.EndTime</td>
                                            <td>@row.NeedPeople</td>
                                            <td>@row.ClassPeople</td>
                                            <td>@row.SubJJ</td>
                                            @{
                                        string state = "";
                                        if (row.ClassPeople < row.NeedPeople)
                                        {
                                            state = "未满";
                                        }
                                        else { state = "已满"; }
                                       
                                            }
                                            <td>@state</td>
                                        </tr> 
                                    }
                                </tr>

                            </tbody>
                        </table>
                    </div>
                </section>
         <footer class="main-footer">
            <div class="container-fluid">
              <div class="row">
                <div class="col-sm-6">
                  <p>LXS &copy; 2019</p>
                </div>
                <div class="col-sm-6 text-right">
                  <p>练习生选课管理系统<a href="#" target="_blank" title="选课管理系统"></a> -  from <a href="#" title="学校" target="_blank">湖南工程</a></p>
                  
                </div>
              </div>
            </div>
          </footer>
        </div>
      </div>
    </div>
    <!-- JavaScript files-->
    <script src="~/Content/UI/vendor/jquery/jquery.min.js"></script>
    <script src="~/Content/UI/vendor/popper.js/umd/popper.min.js"> </script>
    <script src="~/Content/UI/vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="~/Content/UI/vendor/jquery.cookie/jquery.cookie.js"> </script>
    <script src="~/Content/UI/vendor/chart.js/Chart.min.js"></script>
    <script src="~/Content/UI/vendor/jquery-validation/jquery.validate.min.js"></script>
    <!-- Main File-->
    <script src="~/Content/UI/js/front.js"></script>
      <script type="text/javascript">
          $(function () {
              $(".table input:checkbox").attr("checked", false);
              $("#select").click(selectf);

              function selectf() {
                  var end = confirm("确定选择吗？");
                  if (end == true) {
                      var data = [];
                      $(function () {
                          $("#table").find(":checkbox:checked").each(function () {
                              var val = $(this).parent().next().text();
                              data.push(val);
                          });
                          $.ajax({
                              type: "Post",
                              async: true,
                              url: "/Student/kskcselect",
                              data: { subId: data.toString() },
                              success: function (msg) {
                                  if (msg == "ok") {
                                      window.location.href = "/Student/sxkc";
                                      alert("选择成功！");
                                  } else {
                                      alert(msg);
                                  }
                              }
                          });
                      });
                  } else {
                      window.location.href = "/Student/kckc";
                  }
              }
          }
              );
            </script>
  </body>

</html>
